<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/core" prefix="c"%>
<%@ taglib uri="/tags/fmt" prefix="fmt"%>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript">
		function submitForm(action){			
	    	var form = document.getElementById('mainForm');	    	
	    	form.action = action;
	    	form.submit();	    		    	   
		}
		
		function validate(){
        var errors = "";
        var productId = document.getElementById('productViewSearch.productId').value;
        var ton = document.getElementById('productViewSearch.ton').value;        
                                                                    
        if(productId == "" || parseInt( productId ) == 0) {
        	errors += ' <bean:message key="lable.plants.validation.code"/>\n';		        	
        }	
        if(ton == "" || parseInt( ton ) == 0) {
        	errors += ' <bean:message key="lable.corn.error.input.ton"/>\n';
        }        
        if( errors == "" ){
            return true;
        }else{
            alert( '<bean:message key="label.common.errors"/> : \n' + errors );            
			return false;
        }
	}
</script>

<html:form action="/customerFutureEditProduct.do" styleId="mainForm" onsubmit="return validate();">	
	<table align="center" width="40%" cellpadding="2" cellspacing="1" border="0" bgcolor="#CCCCC0">
		<tr>
			<th colspan="2" align="center" class="titulocolumna">
				<bean:message key="label.breadcrum.futurepurchase.newbyclient.productAdd"/>  
			</th>			 
		</tr>
		<tr>
			<td class="etiqueta"><bean:message key="label.transports.query.code"/> </td>
			<td class="etiqueta_campo" style="text-align: left;"> 
				<html:text readonly="true" property="productViewSearch.productId"  size="15" styleClass="campo_texto" />				
				<html:button styleClass="boton_short" property="backButton" onclick="location.href='productEditListAction.do';">...</html:button> 
			</td>			 
		</tr>
		<tr>
			<td class="etiqueta"> <bean:message key="label.transports.query.description"/> </td>
			<td class="etiqueta_campo" style="text-align: left;"> <html:text property="productViewSearch.description" readonly="true" styleClass="campo_texto" size="50" maxlength="255" onfocus="this.select();"/> </td>			 
		</tr>
		<tr>
			<td class="etiqueta"> <bean:message key="message.futurepurchase.ton"/> </td>
			<td class="etiqueta_campo" style="text-align: left;"> <html:text property="productViewSearch.ton"  styleClass="columnanumero" onfocus="this.select();" onkeydown="return (numeric(event, 1) && noPaste(event, this));" onkeyup="extractNumber(this,3,false);"/> </td>			 
		</tr>		
		<tr>
			<td colspan="2" align="center" class="columnadatoPar">
				<html:submit styleClass="boton"><bean:message key="label.common.add"/></html:submit>				
			    &nbsp;&nbsp;<html:button styleClass="boton" property="backButton" onclick="location.href='goEditFuturePurchaseByCustomer.do';"> <bean:message key="label.common.cancel"/> </html:button>
			</td>
		</tr>		
	</table>
</html:form>
<script>
	cleanNumber(document.getElementById('productViewSearch.productId'));
	cleanNumber(document.getElementById('productViewSearch.ton'));
	cleanNumber(document.getElementById('productViewSearch.description'));	
</script>
